<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ include file="/WEB-INF/component/commonTagLib.jsp"%>
<!DOCTYPE html>
<html>
<head>
    <title><spring:message code="message.list.YiLiaoJiGouShangPinMuLuChaKan"/></title>
    <%@ include file="/WEB-INF/component/commonCSS.jsp"%>
</head>

<body class="skin-blue-light sidebar-mini fixed skin-blue-light-frame">

    <section class="content-header">
        <h1>医疗机构采购目录详情</h1>
         <ol class="breadcrumb">
            <li><a href="${ctx}/home.jsp"><i class="fa fa-home"></i><spring:message code="message.lable.first"/></a></li>
            <li class="active"><a href="#">交易</a></li>
            <li class="active"><a href="#">医疗机构采购目录查询</a></li>
            <li class="active"><a href="#">按商品查询</a></li>
        </ol>
    </section>
    
    <section class="content">
        <div class=" box box-success">
            <div class="box-body">
                <div class="input">
                	<div class="textalign1"><spring:message code="message.lable.yiLiaoJiGouMingCheng"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="hospName" name="hospName" placeholder="<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>" />
                     	</div>
                     <div class="textalign"><spring:message code="message.lable.yiLiaoJiGouBianMa"/><spring:message code="message.yanZheng.maoHao"/></div>
                        <div class="boxinput">
                        <input type="text" class="textinput" id="hospCode" name="hospCode" placeholder="<spring:message code="message.lable.yiLiaoJiGouBianMa"/>" />
                     	</div>
                    <div class="textalign1" >
                    <button type="button" class="btn btn-success btn-sm" onclick="search()"  id="selectDicCompType"><spring:message code="message.button.seachSpacing"/></button>
                	</div>
                </div>
            </div>
        </div>
        
        <table class="jqgrid" id="gridlist"></table>
        <div id="gridpage"></div>
        
<div class=" box box-warning bottongroup" id="bottongroup">
			<a href="javascript:history.go(-1)" class="btn btn-danger btn-sm"><spring:message code="message.button.getBackSpacing"/></a>
		</div>
        
        
    </section>
    
    <%@ include file="/WEB-INF/component/commonJS.jsp"%>
    <script type="text/javascript">
  //绑定回车
    $('#hospName,#hospCode,#area1,#area2,#area3').bind('keydown', function(event) {
        if (event.keyCode == "13") {
            $('#selectDicCompType').click();
        }
    });	
    $("#hospName").focus();//加载页面光标在第一个查询框内
    
    
        function showHospInfo(hospId) {
        	$.HN.dialog.open({
                "id": "showHospInfo", 
                "title": "<spring:message code="message.listForm.yiLiaoJiGouxinxi"/>", 
                "url": "${ctx}/stdHospInfo/hospInfoDetail.html?hospId="+hospId,
                "data": {}, 
                "width": 800, 
                "height": 400, 
                "closefunc":function() {
                    
                }
            });
        }
    
        $(function () {
            $("#gridlist").jqGrid({
                url: "getHospListBySC.html?goodsCode=${goodsCode}",
                mtype: "POST",
                datatype: "json",
                autowidth: true,
                height: 283,
                colNames: [
                           '<spring:message code="message.lable.yiLiaoJiGouBianMa"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouMingCheng"/>',
                           '<spring:message code="message.listForm.YiLiaoJiGouDiQu"/>', 
                           '<spring:message code="message.listForm.yiLiaoJiGouFenLei"/>', 
                           '<spring:message code="message.listForm.yiLiaoJiGouLeiXing"/>',
                           '<spring:message code="message.lable.yiLiaoJiGouDengJi"/>',
                           '<spring:message code="message.listForm.zuZhiJiGouDaiMa"/>'
                           ],
                colModel: [   
                    { name: 'hospCode', width: 70 , align:"center",sortable: false,
                    	formatter:function(cellvalue, options, row){
                    		return '<a href="javascript:showHospInfo(\''+ row.hospId +'\');">'+cellvalue+'</a>';
                    	}
                    },
                    { name: 'hospName', width: 120 , align:"center" ,sortable: false},
                    { name: 'areaName', width: 120 , align:"center" ,sortable: false},
                    { name: 'hospClassifyName', width: 70 , align:"center" ,sortable: false},
                    { name: 'hospTypeName', width: 80 , align:"center" ,sortable: false},
                    { name: 'hospLevelName', width: 80 , align:"center" ,sortable: false},
                    { name: 'orgCode', width: 90 , align:"center",sortable: false }
                ],
                rowNum: 20,
                rowList: [10, 20, 30,50,100],
                rownumbers: true,
                pager: "#gridpage",
                viewrecords: true,
                gridComplete:function(){
                	//序号列宽度自适应（参数为jqgridID）
                    autoRNWidth("gridlist");
                	//数据只有一条时默认选中（参数为jqgridID）
                    selectByOneData("gridlist");
                },
                caption: "${goods.drugCode}/${goods.drugName}/${goods.formName}/${goods.specName}/${goods.factor}/${goods.unit}/${goods.materialName}",
                jsonReader: {
                    repeatitems: false,
                    id: "hospId"
                }
            });
            $("#gridlist").jqGrid('navGrid', '#gridpage', { add: false, edit: false, del: false, search: false, refresh: false });
            $(window).trigger("resize");
        });
        function search(page) {
            var hospCode = $("#hospCode").val();
            var hospName = $("#hospName").val();
          
            $("#gridlist").jqGrid("clearGridData");
                $("#gridlist").jqGrid('setGridParam',{  
                mtype: "POST",
                datatype:'json',
                postData:{"hospCode":hospCode, "hospName":hospName},
                page : (page || 1)
            }).trigger("reloadGrid"); //重新载入  
        }
        
    </script>
</body>
</html>